package com.game.business.controller;

import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.util.Base64;

public class MM {

    public static void main(String[] args) throws IOException {
        String  png="filemanage/g.png";
        String encodedPath = Base64.getUrlEncoder().encodeToString(png.getBytes());
        System.out.println("水印图片路径: " + encodedPath);
        // 读取图片文件为字节数组
        File file = new File(png);
        byte[] fileContent = Files.readAllBytes(file.toPath());

        // 转换为Base64编码
        String encodedString = Base64.getEncoder().encodeToString(fileContent);

        // 输出结果
        System.out.println(encodedString);
    }
}
